<?php

    require 'DBControl.php';
    
    //args - recommendation_id, product_id
    if (is_numeric($_POST['recommendation_id']) && is_numeric($_POST['product_id']))
    {
        $db = DBControl::getInstance();
        $db -> PDOquery("INSERT INTO clicks (user_id, item_id) VALUES (?,?);", array($_POST['recommendation_id'], $_POST['product_id']));
        echo json_encode(array('status' => 'success'));
    }
    else
    {
        echo json_encode(array('status' => 'error', 'info' => 'recommendation_id or product_id is not numeric'));
    }

?>
